import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:search_people/utils/component/component.dart';
import 'package:search_people/utils/component/selected_tag_view.dart';

import 'index.dart';
import 'widgets/widgets.dart';

class SearchBirthdayPage extends GetView<SearchBirthdayController> {
  const SearchBirthdayPage({Key? key}) : super(key: key);

  // 主视图
  Widget _buildView() {
    return SelectTagView(
      padding: EdgeInsets.all(12.r),
      items: controller.state.list ?? [],
      runSpacing: 10.r,
      spacing: 10.r,
      onTap: (p0) {
        var m = controller.state.list![p0.first];

        Get.back(result: m.substring(0, 4));
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<SearchBirthdayController>(
      builder: (_) {
        return Scaffold(
          appBar: detailAppBar(context, title: '按出生年代'),
          body: SafeArea(
            child: Container(
              color: Colors.white,
              width: Get.width,
              padding: EdgeInsets.symmetric(horizontal: 12.r, vertical: 10.r),
              child: _buildView(),
            ),
          ),
        );
      },
    );
  }
}
